import app

import requests

"""
封装类
"""


class Organization:
    def __init__(self):
        self.url_organization = app.BASE_URL + "/api/company/department"

    # 封装组织架构列表
    def query_organization_list(self, headers):
        return requests.get(url=self.url_organization, headers=headers)

    # 封装添加部门信息
    def add_organization(self, headers, data_json):
        return requests.post(url=self.url_organization, headers=headers, json=data_json)

    # 封装查询部门信息
    def select_organization(self, headers, id1):
        return requests.get(url=self.url_organization + "/" + id1, headers=headers)

    # 封装修改部门信息
    def update_organization(self, headers, json_data, id1):
        return requests.put(url=self.url_organization + "/" + id1, headers=headers, json=json_data)

    # 封装删除部门信息
    def delete_organization(self, headers, id1):
        return requests.delete(url=self.url_organization + "/" + id1, headers=headers)
